﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Reflection.Metadata;
using System.Text;
using System.Threading.Tasks;

namespace EntityModel
{
    /// <summary>
    /// 食堂人员管理
    /// </summary>
    public class User
    {
        /// <summary>
        /// 数据唯一标识
        /// </summary>
        [Key]
        [Required]
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        public Guid Id { get; set; } = Guid.NewGuid();

        /// <summary>
        /// 姓_氏
        /// </summary>
        [Required]
        [StringLength(50)]
        public string? FirstName { get; set; }

        /// <summary>
        /// 姓_名
        /// </summary>
        [Required]
        [StringLength(50)]
        public string? LastName { get; set; }

        /// <summary>
        /// 获取姓名，不映射到数据库
        /// </summary>
        [NotMapped]
        public string? Name { get=>this.FirstName+this.LastName; }

        /// <summary>
        /// 0：管理员1：厨师 2:服务员
        /// </summary>
        [Required]
        public int Type { get; set; }

        /// <summary>
        /// 支付薪资
        /// </summary>
        [Required]
        public float Pay { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        [Required]
        public bool Gender { get; set; }

        /// <summary>
        /// 年龄
        /// </summary>
        [Required]
        public int  Age { get; set; }

        /// <summary>
        /// 加入时间（默认数据创建时系统时间）
        /// </summary>
        [Required]
        public DateTime AddTime { get; set; }

        /// <summary>
        /// 离职时间（据此判断是否离职
        /// </summary>
        public DateTime DimissionTime { get; set; }

        /// <summary>
        /// 休假时间（据此判断是否是休假状态）
        /// </summary>
        public DateTime HolidayTime { get; set; }
    }
}
